﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading;

namespace DO.Workflows
{
    [DataContract]
    public class Job
    {
        #region props
        [DataMember]
        public Guid JobID { get; set; }
        [DataMember]
        public Guid RunID { get; set; }
        [DataMember]
        public Guid ComponentID { get; set; }
        [DataMember]
        public List<Guid> Dependencies { get; set; }
        [DataMember]
        public bool HasError { get; set; }
        [DataMember]
        public bool IsFirstJob { get; set; }
        [DataMember]
        public bool IsLastJob { get; set; }
        [DataMember]
        public bool Cancelled { get; set; }
        [DataMember]
        public ThreadPriority Priority { get; set; }
        [DataMember]
        public DateTime? ReceiveTime { get; set; }
        [DataMember]
        public DateTime? SubmissionTime { get; set; }
        [DataMember]
        public DateTime? StartTime { get; set; }
        [DataMember]
        public DateTime? FinishTime { get; set; }
        #endregion

        #region ctor
        public Job()
        {
            this.JobID = Guid.Empty;
            this.RunID = Guid.Empty;
            this.Dependencies=new List<Guid>();
            this.HasError = false;
            this.IsFirstJob = false;
            this.IsLastJob = false;
            this.Cancelled = false;
            this.Priority = ThreadPriority.Normal;
            this.ReceiveTime = null;
            this.SubmissionTime = null;
            this.StartTime = null;
            this.FinishTime = null;
        }
        #endregion
    }
}
